package com.itheima.demo1;

import java.util.Scanner;

public class ArrayTest5 {
    public static void main(String[] args) {
        int[] arr={19,28,37,46,50};
        int index=-1;
        Scanner sc = new Scanner(System.in);
        System.out.println("输入一个数字查索引");
        int number = sc.nextInt();
        for (int i = 0; i < arr.length; i++) {
            if (number == arr[i]) {
                  index=i;
                break;
            }

        }
        System.out.println(index);
    }
}
